package priv.mill.graph.search;

public class Queue {
    public static final int SIZE = 20;
    private int[] st;
    private int front;
    private int rear;

    public Queue() {
        st = new int[SIZE];
        rear=-1;
    }

    public void insert(int v) {
        if (rear == SIZE - 1) {
            rear = -1;
        }
        st[++rear] = v;
    }

    public int remote() {
        int temp = st[front++];
        if (front == SIZE) {
            front=0;
        }
        return temp;
    }

    public boolean isEmpty() {
        return rear + 1 == front || rear + 1 == front + SIZE;
    }
}
